package main

import (
	"google.golang.org/protobuf/proto"
	"log"
	"log/slog"
	"os"
	"xin/raft/pb"
)

func main() {
	var filename = "D:\\project\\go\\src\\xin-raft\\example\\election_test\\node_3\\raft.meta"

	bytes, err := os.ReadFile(filename)
	if err != nil {
		log.Fatal(err)
	}

	var meta innerMeta
	err = proto.Unmarshal(bytes, &meta)

	if err != nil {
		log.Fatal(err)
	}

	slog.Info("meta: ", "term", meta.Term, "voteFor", meta.VoteFor)
}

type innerMeta struct {
	pb.RaftMeta
}
